<?php

namespace app\services\websocket;

use think\swoole\Websocket;

class Open
{
    public function handle($request ) {

//        $userId = get_current_user_id_from_request($request); // 你需要实现这个函数
//
//        // 2. 获取 Swoole Table
//        $table = app('swoole.server')->ws_user_map;
//
//        // 3. 存储映射关系 (FD -> UID)
//        $table->set($ws->getSender(), ['user_id' => $userId]);
//        dump($request);
        echo "EIO:". $request->param('EIO');
        echo "websocket open". PHP_EOL;
        dump($request->param('EIO'));
        $ws = app(Websocket::class);
        $fd = $ws->getSender();

        dump($fd);
        dump("websocket open--end");

    }
}